/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Model;

import java.awt.Color;
import java.util.Observable;
/**
 *
 * @author Benjamin
 */
public class Grille extends Observable{
    private Case[][] matrice;
    
    /*  
     *         /!\      X signifie la ligne (de 0 à 19) Y signifie la colonne (0-9)    /!\
     */
    
    
    public Grille(int x, int y){
        matrice = new Case[x][y];
        for(int i = 0; i<x; i++ ){
            for(int j = 0; j<y; j++){                   
                this.matrice[i][j] = new Case(Color.WHITE,false);               
            }
        }
    }
    
    public Case[][] getMatrice(){
        return this.matrice;
    }
    
    public void setMatrice(int x, int y, Case c){
        this.matrice[x][y] = c;
    }
    
    public void afficherGrille(){
        int a = 0;
        String str ="";
        for(int i = 0; i<20; i++ ){
            for(int j = 0; j<10; j++){  
                if (a != i) {
                    str += "\n";
                }
                a = i;
                if(this.matrice[i][j].getOccupe()){
                    str += "1 ";
                }
                else str += "0 ";
                             
            }
        }
        System.out.println(str);
    }
    
    
}
